package com.mystudy.selfCheck;

import org.junit.Test;

import java.util.ArrayList;


/**
 * @program: infoalgorithm
 * @description: 2341
 * @author: zhouzhilong
 * @create: 2019-02-27 18:06
 **/
public class testException {



    @Test
    public void testList() {
        String[] array = new String[10];
                System.out.println(array.length);
    }

    @Test
    public void testBili() {
        int x = 3585;
        int y = 2868;
        int z = 5736;

        int to = 152;
        ArrayList<Integer> zs = getZs(x, y, z);
        //三个里面最小的,然后找到里面的质数数列,然后判断是否都能够整除,只要都能整除,就更新数列
        while (true) {
            if (x % 2 == 0 && y % 2 == 0 && z % 2 == 0) {
                x = x / 2;
                y = y / 2;
                z = z / 2;
            } else {
                while (x % 2 != 0) {
                    x++;
                }
                while (y % 2 != 0) {
                    y++;
                }
                while (z % 2 != 0) {
                    z++;
                }

            }
            if (x < 5) {
                break;
            }
        }
        System.out.println(String.format("x:%s,y:%s,z:%s", x, y, z));
        //4m+4n+2t = 152
        //4m:4n:2t = x:y:z
    }

    private ArrayList<Integer> getZs(int x, int y, int z) {
        int min = x < y ? (x < z ? x : z) : (y < z ? y : z);
        ArrayList<Integer> integers = new ArrayList<>();
        integers.add(2);
        integers.add(3);
        System.out.println("min:" + min);
        for (int i = 5; i < min; i++) {
            for (int m = 2; m <= i; m++) {
                if (i % m == 0 && m != i) {
                    break;
                } else {
                    if (m == i) {
                        integers.add(i);
                    }
                }
            }

        }
        System.out.println(integers);
        return integers;
    }

    private ArrayList<Integer> getZs(int x, int y) {
        int min = x < y ? x : y;
        ArrayList<Integer> integers = new ArrayList<>();
        integers.add(2);
        integers.add(3);
        System.out.println("min:" + min);
        for (int i = 5; i < min; i++) {
            for (int m = 2; m <= i; m++) {
                if (i % m == 0 && m != i) {
                    break;
                } else {
                    if (m == i) {
                        integers.add(i);
                    }
                }
            }

        }
        System.out.println(integers);
        return integers;
    }


    private ArrayList<Integer> getZs(int min) {
        ArrayList<Integer> integers = new ArrayList<>();
        integers.add(2);
        integers.add(3);
        System.out.println("min:" + min);
        for (int i = 5; i < min; i++) {
            for (int m = 2; m <= i; m++) {
                if (i % m == 0 && m != i) {
                    break;
                } else {
                    if (m == i) {
                        integers.add(i);
                    }
                }
            }

        }
        System.out.println(integers);
        return integers;
    }


}
